function detect(gid, playerName, repeat) {
	// alert(repeat);
	var xmlhttp_request = "";
	try {
		if (window.ActiveXObject) {
			for ( var i = 5; i; i--) {
				try {
					if (i == 2) {
						xmlhttp_request = new ActiveXObject("microsoft.xmlhttp");
					} else {
						xmlhttp_request = new ActiveXObject("msxml2.xmlhttp."
								+ i + ".0");
						xmlhttp_request.setRequestHeader("Content-Type",
								"text/xml");
						xmlhttp_request.setRequestHeader("Charset", "UTF-8");
					}
					break;
				} catch (e) {
					xmlhttp_request = false;
				}
			}
		} else if (window.XMLHttpRequest) {
			xmlhttp_request = new XMLHttpRequest();
			if (xmlhttp_request.overrideMimeType) {
				xmlhttp_request.overrideMimeType("text/xml");
			}
		}
	} catch (e) {
		xmlhttp_request = false;
	}
	// alert(xmlhttp_request);

	// TODO later should use "POST" way
	xmlhttp_request.open('GET', 'detect.jsp?gid=' + gid + '&playerName='
			+ playerName, true);
	xmlhttp_request.send(null);

	xmlhttp_request.onreadystatechange = function() {
		if (xmlhttp_request.readyState == 4) {
			// document.getElementById("div1").innerHTML =
			// xmlhttp_request.responseText;
			// alert(xmlhttp_request.getAllResponseHeaders());
			//alert(xmlhttp_request.responseText);
			processXMLdoc(xmlhttp_request.responseXML);
		} else {
		}
	}
	if (repeat)
		setTimeout("detect('" + gid + "', '" + playerName + "', true)", 1000);

}
